package com.jmoney.luckeylink.controller;

import static io.restassured.RestAssured.given;

import io.restassured.RestAssured;
import io.restassured.config.SSLConfig;
import io.restassured.response.Response;

public class LekeU_SharingKeys_Controller {
    /**
	    * 指定接口地址，获取IC申请状态信息
	    * @param ApiUrl
	    * @return RoomUserMap
	    */
    public static Object[] GetSharingKeysInfo(String ApiUrl, String Param) throws Exception{

	       
	       Response response = given()
	               .config((RestAssured.config().sslConfig(new SSLConfig().relaxedHTTPSValidation())))
	               .contentType("application/x-www-form-urlencoded; charset=UTF-8")
	               .log().all()
	               .request()
	               .body(Param)
	               .when()
	               .post(ApiUrl);

	       response.print();
           String Json = response.asString();
	       
	       int status_code = response.jsonPath().getInt("status_code");
	       String message = response.jsonPath().get("message");
	       String share_path = response.jsonPath().get("data.share_path");
	       String share_id =share_path.replaceAll("pages/index\\?share_id=", "");
	       
           Object[] SharingKeysInfo ={Json,status_code,message,share_id};
           
	       return SharingKeysInfo;
	}   
}
